package com.ibeeking.found.org.service.common.enums;

import com.ibeeking.nematos.utils.data.StringUtils;

/**
 * @Description:
 * @Author ibeeking
 * @Date 2022/1/24 13:57
 **/
public enum EmployeeFieldDataTypeEnum {
    TEXT(1, "文本"),
    NUM(2, "数字"),
    DATE(3, "日期"),
    IMG(4, "图片"),
    CHECK_BOX_ONE(5, "单选框"),
    CHECK_BOX_MANY(6, "多选框"),
    ;

    private Integer code;
    private String name;


    EmployeeFieldDataTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static EmployeeFieldDataTypeEnum getEnum(Integer code) {
        for (EmployeeFieldDataTypeEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj;
            }
        }
        return null;
    }

    public static String getName(Integer code) {
        for (EmployeeFieldDataTypeEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj.getName();
            }
        }
        return StringUtils.EMPTY;
    }
}
